package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.MqMessageClient;
import com.zqh.myfmmall.result.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-19 16:38
 */
@Slf4j
public class MqMessageClientFallback implements FallbackFactory<MqMessageClient>{
    @Override
    public MqMessageClient create(Throwable cause) {
        log.warn("exception in calling mqmessage service"+cause);
        return new MqMessageClient(){
            @Override
            public Result delayedMessage(String message) {
                return Result.internalServerError();
            }

            @Override
            public Result delayedMessage(String message, Integer ttl) {
                return Result.internalServerError();
            }
        };
    }
}
